<?php
session_start();

require_once("utilities.inc");
require_once("SimpleImage.php");

accesControl();
	if($_FILES["fichero"]["error"] == 0)
		$imageName = uploadImage($_FILES["fichero"]["name"], $_FILES["fichero"]["tmp_name"], false);
	else
		$imageName = "";

if($imageName != ""){

	$mainQuery = "INSERT INTO fotos (Titulo, Fecha, Pais, Album, Fichero, FRegistro)";
	$values = " VALUES ('" . $_POST['titulo'] . "', '" . $_POST['date'] . "', '" . $_POST['pais'] . "', '" . $_POST['album'] . "', '" . $imageName . "', '" . date("Y-m-d H:i:s") . "');";

	mysqlQuery($mainQuery . $values);
	gotoPage("../user.php");
}else{
	echo $imgErrorMsg[$_FILES["fichero"]["error"]];
}
?>